Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@hebcal/leyning
Advanced tools
Javascript Torah Reading API for Parashat HaShavua and holidays
This package includes both traditional (full kriyah) and weekday Torah readings.
Triennial Torah Readings have moved to @hebcal/triennial
$ npm install @hebcal/leyning
import {HebrewCalendar, HDate, Event} from '@hebcal/core';
import {getLeyningForParshaHaShavua, formatAliyahWithBook} from '@hebcal/leyning';
const events = HebrewCalendar.calendar({sedrot: true, noHolidays: true});
const ev = events.find((ev) => ev.getDesc() == 'Parashat Pinchas');
const reading = getLeyningForParshaHaShavua(ev, false);
console.log(`${ev.getDesc()}: ${reading.summary}`);
console.log(`Haftara: ${reading.haftara}`);
for (const [num, aliyah] of Object.entries(reading.fullkriyah)) {
const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
let str = formatAliyahWithBook(aliyah);
if (reading.reason[num]) {
str += ' | ' + reading.reason[num];
}
str += ` (${aliyah.v} verses)`;
console.log(`${number}: ${str}`);
}
Array.<string>
Names of the books of the Torah. BOOK[1] === 'Genesis'
string
Formats parsha as a string
any
Makes a deep copy of the src object using JSON stringify and parse
number
Calculates the number of verses in an aliyah or haftara based on
the b
(begin verse), e
(end verse) and k
(book).
Modifies aliyah
by setting the v
field.
string
Formats an aliyah object like "Numbers 28:9-28:15"
string
Formats an aliyah object like "Numbers 28:9-15"
number
Returns the total number of verses in an array of Aliyah (or haftarah) objects
Array.<Aliyah>
Summarizes an AliyotMap
by collapsing all adjacent aliyot.
Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
string
Returns a string representation of the leyning parts.
Separate verse ranges read from the same book are separated
by commas, e.g. Isaiah 6:1-7:6, 9:5-6
.
Verse ranges from different books are separated by semicolons,
e.g. Genesis 21:1-34; Numbers 29:1-6
.
string
Makes a summary of the leyning, like "Genesis 6:9-11:32"
boolean
Is there a special festival Torah Reading for holiday
?
any
Returns the raw metadata for festival reading for holiday
string
Based on the event date, type and title, finds the relevant leyning key
SpecialReading
Determines if the regular parashat haShavua coincides with an event that requires a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh Chodesh or Machar Chodesh, etc.).
This function does not modify aliyot
. Instead, it returns a deep copy
with aliyot['M']
replaced and sets reason.M
(and in some cases the 6th and 7th aliyah, setting reason['7']
).
If a special Haftarah applies, the result will have a haft
property
pointing to Haftarah object and sets reason.haftara
.
Leyning
Looks up leyning for a given holiday key. Key should be an (untranslated) string used in holiday-readings.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Leyning
Looks up leyning for a given holiday. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Object.<string, Aliyah>
Looks up Monday/Thursday aliyot for a regular parsha
Leyning
Looks up regular leyning for a weekly parsha with no special readings
Leyning
Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.
ParshaMeta
Returns the parsha metadata
Leyning
| Array.<Leyning>
Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
If hdate
coincides with a holiday that has Torah reading, returns the
reading for that day (see getLeyningForHoliday)
Otherwise, if hdate
is a Saturday, returns getLeyningForParshaHaShavua
Otherwise, if hdate
is a Monday or Thursday, returns Leyning for the
Parashat haShavua, containing only the weekday
aliyot (no fullkriyah
).
Otherwise, returns undefined
.
Formats reading for CSV
Object
Represents an aliyah
Object
Leyning for a parsha hashavua or holiday
Object
Name of the parsha hashavua or holiday
Object
Leyning for a parsha hashavua or holiday
Object
Parsha metadata
Array.<string>
Names of the books of the Torah. BOOK[1] === 'Genesis'
Kind: global constant
Read only: true
string
Formats parsha as a string
Kind: global function
Param | Type | Description |
---|---|---|
parsha | string | Array.<string> | untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
any
Makes a deep copy of the src object using JSON stringify and parse
Kind: global function
Param | Type |
---|---|
src | any |
number
Calculates the number of verses in an aliyah or haftara based on
the b
(begin verse), e
(end verse) and k
(book).
Modifies aliyah
by setting the v
field.
Kind: global function
Param | Type |
---|---|
aliyah | Aliyah |
string
Formats an aliyah object like "Numbers 28:9-28:15"
Kind: global function
Param | Type | Description |
---|---|---|
a | Aliyah | aliyah |
string
Formats an aliyah object like "Numbers 28:9-15"
Kind: global function
Param | Type |
---|---|
aliyah | Aliyah |
showBook | boolean |
number
Returns the total number of verses in an array of Aliyah (or haftarah) objects
Kind: global function
Param | Type |
---|---|
aliyot | Aliyah | Array.<Aliyah> |
Array.<Aliyah>
Summarizes an AliyotMap
by collapsing all adjacent aliyot.
Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
Kind: global function
Param | Type |
---|---|
aliyot | Object.<string, Aliyah> |
string
Returns a string representation of the leyning parts.
Separate verse ranges read from the same book are separated
by commas, e.g. Isaiah 6:1-7:6, 9:5-6
.
Verse ranges from different books are separated by semicolons,
e.g. Genesis 21:1-34; Numbers 29:1-6
.
Kind: global function
Param | Type |
---|---|
parts | Aliyah | Array.<Aliyah> |
string
Makes a summary of the leyning, like "Genesis 6:9-11:32"
Kind: global function
Param | Type |
---|---|
aliyot | Object.<string, Aliyah> |
boolean
Is there a special festival Torah Reading for holiday
?
Kind: global function
Param | Type |
---|---|
holiday | string |
any
Returns the raw metadata for festival reading for holiday
Kind: global function
Param | Type |
---|---|
holiday | string |
string
Based on the event date, type and title, finds the relevant leyning key
Kind: global function
Returns: string
- key to look up in holiday-reading.json
Param | Type | Default | Description |
---|---|---|---|
ev | Event | event | |
[il] | boolean | false | true if Israel holiday scheme |
SpecialReading
Determines if the regular parashat haShavua coincides with an event that requires a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh Chodesh or Machar Chodesh, etc.).
This function does not modify aliyot
. Instead, it returns a deep copy
with aliyot['M']
replaced and sets reason.M
(and in some cases the 6th and 7th aliyah, setting reason['7']
).
If a special Haftarah applies, the result will have a haft
property
pointing to Haftarah object and sets reason.haftara
.
Kind: global function
Param | Type |
---|---|
parsha | Array.<string> |
hd | HDate |
il | boolean |
aliyot | Object.<string, Aliyah> |
Leyning
Looks up leyning for a given holiday key. Key should be an (untranslated) string used in holiday-readings.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Description |
---|---|---|
key | string | name from holiday-readings.json to find |
[cholHaMoedDay] | number | |
[il] | boolean |
Leyning
Looks up leyning for a given holiday. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Default | Description |
---|---|---|---|
ev | Event | the Hebcal event associated with this leyning | |
[il] | boolean | false | true if Israel holiday scheme |
Object.<string, Aliyah>
Looks up Monday/Thursday aliyot for a regular parsha
Kind: global function
Returns: Object.<string, Aliyah>
- map of aliyot
Param | Type | Description |
---|---|---|
parsha | string | Array.<string> | untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
Leyning
Looks up regular leyning for a weekly parsha with no special readings
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Description |
---|---|---|
parsha | string | Array.<string> | untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
Leyning
Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Default | Description |
---|---|---|---|
ev | Event | the Hebcal event associated with this leyning | |
[il] | boolean | false | in Israel |
ParshaMeta
Returns the parsha metadata
Kind: global function
Param | Type | Description |
---|---|---|
parsha | string | Array.<string> | untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
Leyning
| Array.<Leyning>
Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
If hdate
coincides with a holiday that has Torah reading, returns the
reading for that day (see getLeyningForHoliday)
Otherwise, if hdate
is a Saturday, returns getLeyningForParshaHaShavua
Otherwise, if hdate
is a Monday or Thursday, returns Leyning for the
Parashat haShavua, containing only the weekday
aliyot (no fullkriyah
).
Otherwise, returns undefined
.
Kind: global function
Returns: Leyning
| Array.<Leyning>
- map of aliyot
Param | Type | Default | Description |
---|---|---|---|
hdate | HDate | Hebrew Date | |
il | boolean | in Israel | |
[wantarray] | boolean | false | to return an array of 0 or more readings |
Formats reading for CSV
Kind: global function
Param | Type |
---|---|
stream | fs.WriteStream |
ev | Event |
reading | Leyning |
il | boolean |
isParsha | boolean |
Object
Represents an aliyah
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
k | string | Book (e.g. "Numbers") |
b | string | beginning verse (e.g. "28:9") |
e | string | ending verse (e.g. "28:15") |
[v] | number | number of verses |
[p] | number | parsha number (1=Bereshit, 54=Vezot HaBracha) |
Object
Leyning for a parsha hashavua or holiday
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
aliyot | Object.<string, Aliyah> | Map of aliyot 1 through 7 plus M for maftir |
[reason] | Object.<string, string> | Explanations for special readings, keyed by aliyah number, M for maftir or haftara for Haftarah |
haft | Aliyah | Array.<Aliyah> | Haftarah object(s) |
seph | Aliyah | Array.<Aliyah> | Haftarah object(s) |
Object
Name of the parsha hashavua or holiday
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
en | string | English |
he | string | Hebrew (with nikud) |
Object
Leyning for a parsha hashavua or holiday
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | LeyningNames | |
[parsha] | Array.<string> | An array of either 1 (regular) or 2 (doubled parsha). undefined for holiday readings |
[parshaNum] | number | 1 for Bereshit, 2 for Noach, etc. undefined for holiday readings |
summary | string | Such as Genesis 1:1 - 6:8 |
haft | Aliyah | Array.<Aliyah> | Haftarah object(s) |
haftara | string | Haftarah, such as Isaiah 42:5 – 43:11 |
[haftaraNumV] | number | Number of verses in the Haftarah |
[seph] | Aliyah | Array.<Aliyah> | Haftarah object(s) for Sephardim |
[sephardic] | string | Haftarah for Sephardim, such as Isaiah 42:5 - 42:21 |
[sephardicNumV] | number | Number of verses in the Haftarah for Sephardim |
fullkriyah | Object.<string, Aliyah> | Map of aliyot 1 through 7 plus M for maftir |
[weekday] | Object.<string, Aliyah> | Optional map of weekday Torah Readings aliyot 1 through 3 for Monday and Thursday |
[reason] | Object.<string, string> | Explanations for special readings, keyed by aliyah number, M for maftir or haftara for Haftarah |
[megillah] | Object.<string, Aliyah> | Optional map of megillah reading. Song of Songs is read on the sabbath of Passover week, the Book of Ruth on Shavuot, Lamentations on Tisha be-Av, Ecclesiastes on the sabbath of the week of Sukkoth, and the Book of Esther on Purim. |
Object
Parsha metadata
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
num | number | 1 for Bereshit, 2 for Noach, etc. undefined for holiday readings |
hebrew | string | parsha name in Hebrew with niqud |
book | number | 1 for Genesis, 2 for Exodus, 5 for Deuteronomy |
haft | Aliyah | Array.<Aliyah> | Haftarah object(s) |
[seph] | Aliyah | Array.<Aliyah> | Haftarah object(s) for Sephardim |
fullkriyah | Object.<string, Array.<string>> | Map of aliyot 1 through 7 plus M for maftir |
weekday | Object.<string, Array.<string>> | Map of weekday Torah Readings aliyot 1 through 3 for Monday and Thursday |
FAQs
Torah Reading API for Parashat HaShavua and holidays
We found that @hebcal/leyning demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.